package com.bwie.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bwie.mapper.TbShopCouponMapper;
import com.bwie.pojo.TbShop;
import com.bwie.pojo.TbShopCoupon;
import com.bwie.service.TbShopService;
import com.bwie.mapper.TbShopMapper;
import com.bwie.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author Yoo19
* @description 针对表【tb_shop】的数据库操作Service实现
* @createDate 2025-07-15 11:52:31
*/
@Service
public class TbShopServiceImpl extends ServiceImpl<TbShopMapper, TbShop>
    implements TbShopService{
    @Autowired
    private TbShopMapper tbShopMapper;
    @Autowired
    private TbShopCouponMapper tbShopCouponMapper;
    @Override
    public R getShopList() {
        List<TbShop> tbShops = tbShopMapper.selectList(null);
        return R.OK(tbShops);
    }

    @Override
    public R getDetailList(Integer shopId) {
       List<TbShopCoupon> tbShopCouponList = tbShopCouponMapper.getDetailList(shopId);
        return R.OK(tbShopCouponList);
    }

    @Override
    public R addShop(TbShop tbShop) {

        tbShopMapper.insert(tbShop);
        return R.OK();
    }

    @Override
    public R updateShop(TbShop tbShop) {

        tbShopMapper.updateById(tbShop);
        return R.OK();
    }

    @Override
    public R deleteShop(Integer shopId) {
        tbShopMapper.deleteById(shopId);
        return R.OK();
    }
}




